package de.nak.fireDepartment.actionForms;

import java.util.Collection;

import org.apache.struts.upload.FormFile;
import org.apache.struts.validator.ValidatorForm;

import de.nak.fireDepartment.model.Equipment;

/**
 * Action form containing the list of equipments.
 * 
 * @author Nils Bredow
 */
@SuppressWarnings("serial")
public class EquipmentForm extends ValidatorForm {
	/** Attribute containing the selected key. */
	private Long selectedKey;
	/** The list containing all equipments. */
	private Collection<Equipment> equipments;
	/** The current equipment. */
	private Equipment equipment;
	/** The selectedCar Names */
	private Collection<String> selectedCarNames;
	/** The Image-File for the Equipment */
	private FormFile aEquipmentImageFile;
	/** A Error Code to display */
	private String errorCode;
	
	/**
	 * Returns the selected room id.
	 * @return a Long value.
	 */
	public Long getSelectedKey() {
		return selectedKey;
	}

	/**
	 * Sets the selected room id.
	 * @param Long value to set.
	 */
	public void setSelectedKey(Long selectedKey) {
		this.selectedKey = selectedKey;
	}

	/**
	 * Returns the list of equipments.
	 * @return the equipment list.
	 */
	public Collection<Equipment> getEquipments() {
		return equipments;
	}
	
	/**
	 * Sets the list of equipments.
	 * @param list of equipments to set.
	 */
	public void setEquipments(Collection<Equipment> equipments) {
		this.equipments = equipments;
	}

	/**
	 * Returns the current equipment.
	 * @return the equipment.
	 */
	public Equipment getEquipment() {
		return equipment;
	}

	/**
	 * Sets the current equipment.
	 * @param equipment to set.
	 */
	public void setEquipment(Equipment equipment) {
		this.equipment = equipment;
	}

	/**
	 * Gets the selectedCarNames
	 * @return list of CarNames
	 */
	public Collection<String> getSelectedCarNames() {
		return selectedCarNames;
	}

	/**
	 * Sets the selectedCarNames
	 * @param list of CarNames
	 */
	public void setSelectedCarNames(Collection<String> selectedCarNames) {
		this.selectedCarNames = selectedCarNames;
	}

	/**
	 * Gets the equipment image file
	 * @return form file
	 */
	public FormFile getaEquipmentImageFile() {
		return aEquipmentImageFile;
	}

	/**
	 * Sets the equipment image file
	 * @param form file to set
	 */
	public void setaEquipmentImageFile(FormFile aEquipmentImageFile) {
		this.aEquipmentImageFile = aEquipmentImageFile;
	}

	/**
	 * Gets the errorCode
	 * @return string
	 */
	public String getErrorCode() {
		if (errorCode == null || errorCode.equals("")){
			errorCode = "text.error.empty";
		}			
		return errorCode;
	}

	/**
	 * Sets the errorCode
	 * @param String to Set
	 */
	public void setErrorCode(String errorCode) {
		this.errorCode = errorCode;
	}	
	
}
